package com.lambda;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;

/**
 * Created by zhaoben on 2016/12/3.
 */
public class TestPredicate {

    public static <T> List<T> fillter(List<T> list, Predicate<T> p){
        List<T> result = new ArrayList<T>();
        for (T t: list) {
            if(p.test(t)){
              result.add(t);
            }
        }
        return result;
    }

    public static void main(String[] args) {
        List<String> list = Arrays.asList("zhaoben", "", "zhaoxiaoming");
        fillter(list,(String str) -> !str.isEmpty());
    }
}
